package com.ssm.pre.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pre.service.WechatMenuService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;

/**
 * 微信自定义菜单 数据表wechat_button_menu
 * @author mps
 *
 */
@Controller
public class WechatMenuController {

	@Autowired
	private WechatMenuService wechatMenuService;
	
	/**
	 * 生成菜单版本号
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/getmenuVersion")
	@ResponseBody
	public void getmenuVersion(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.getmenuVersion(inputObject, outputObject);
	}
	/**
	 * 查找相同的菜单版本号
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/selectMenuByVersion")
	@ResponseBody
	public void selectMenuByVersion(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.selectMenuByVersion(inputObject, outputObject);
	}
	
	/**
	 * 查询所有的微信自定义菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/queryMenuByList")
	@ResponseBody
	public void queryMenuByList(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.queryMenuByList(inputObject, outputObject);
	}
	
	/**
	 * 添加微信自定义菜单 一级菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/addMenuByOne")
	@ResponseBody
	public void addMenuByOne(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.addMenuByOne(inputObject, outputObject);
	}
	
	/**
	 * 添加微信自定义菜单 二级菜单
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/addMenuByTwo")
	@ResponseBody
	public void addMenuByTwo(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.addMenuByTwo(inputObject, outputObject);
	}
	
	/**
	 * 根据ID修改一条记录
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/updateMenuById")
	@ResponseBody
	public void updateMenuById(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.updateMenuById(inputObject, outputObject);
	}
	
	/**
	 * 根据ID查询一条记录
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/selectMenuById")
	@ResponseBody
	public void selectMenuById(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.selectMenuById(inputObject, outputObject);
	}
	
	/**
	 * 发布菜单 更新菜单发布状态
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/updateMenuPublish")
	@ResponseBody
	public void updateMenuPublish(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.updateMenuPublish(inputObject, outputObject);
	}
	
	/**
	 * 根据ID删除一条菜单记录（联动删除 一级和二级菜单全删）
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/deleteMenuById")
	@ResponseBody
	public void deleteMenuById(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.deleteMenuById(inputObject, outputObject);
	}
	
	/**
	 * 增加自定义菜单时，删除当前菜单项
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatMenuController/deleteMenus")
	@ResponseBody
	public void deleteMenus(InputObject inputObject, OutputObject outputObject)throws Exception{
		wechatMenuService.deleteMenus(inputObject, outputObject);
	}
}
